using System;
using System.Collections.Generic;
using System.Web.UI;
namespace JQueryControlToolkit.Controls
{
	public class Trigger : JQueryExtender
	{
		public TriggerEvent TriggerEvent
		{
			get;
			set;
		}
		[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
		public Container<JQueryAction> Callback
		{
			get;
			set;
		}
		public bool UseLiveBinding
		{
			get;
			set;
		}
		protected override string jQueryFunction
		{
			get
			{
				return this.UseLiveBinding ? "live" : "bind";
			}
		}
		public Trigger()
		{
			this.UseLiveBinding = true;
		}
		protected override Dictionary<string, object> EvaluateParameters(Dictionary<string, object> properties)
		{
			return new Dictionary<string, object>
			{

				{
					"",
					new List<object>
					{
						DomResult.Escape(Trigger.GetTriggerEventFunction(this.TriggerEvent)),
						new JSFunction(this.Callback.Elements.ToArray())
					}
				}
			};
		}
		public static string GetTriggerEventFunction(TriggerEvent trigger)
		{
			return JQuery.GetPlugInMethod("JQuery:" + trigger.ToString());
		}
	}
}
